<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace web\common\model;

/**
 * Description of StoreBaseModel
 * 商家基类
 * @author shilinqing
 */
class StoreBaseModel extends BaseModel{
    
    /**
     * 所属商家ID
     * @var type 
     */
    protected $store_id = 0;
    
    public function __construct($store_id = 0) {
//        $this->config_type = 2;
        $this->store_id = $store_id;
        parent::__construct();
    }
    
    /**
     * 获取条件
     * @param type $data
     * @return type
     */
    protected function getWhere($data = null) {
        if (!$data)
            $data = array();
        if ($this->store_id > 0) {
            if($this->tableName == 'store')
                $data['id'] = $this->store_id;
            else
                $data['store_id'] = $this->store_id;
        }
        return $data;
    }
    
}
